<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="https://www.baidu.com/s">
        <input type="text" name="wd">
        <button>提交</button>
    </form>

    <script>
        let form = document.querySelector('form');
        let button = document.querySelector('form');
        let input = document.querySelector('input');

        //表单提交时的事件  onsubmit 
        form.onclick = function(e){
            // e.preventDefault();
        }

        input.onkeydown = function(e){
            e.preventDefault();
        }
    </script>
</body>
</html>